<template>
  <div>
      <el-card v-if="optionsM==0">
        <el-table
          :data="studentAchievement"
          style="width: 100%">
          <el-table-column prop="courseCode" label="课程号" width="80"></el-table-column>
          <el-table-column prop="courseName" label="课程名" width="110"></el-table-column>
          <el-table-column prop="achievement" label="成绩" width="80"></el-table-column>
        </el-table>
    </el-card>
    <el-card v-else>
        <el-table
          :data="teacherAchievement"
          style="width: 100%">
          <el-table-column prop="teacherCode" label="职工号" width="80"></el-table-column>
          <el-table-column prop="teacherName" label="教师名" width="110"></el-table-column>
          <el-table-column prop="courseCode" label="课程号" width="80"></el-table-column>
          <el-table-column prop="courseName" label="课程名" width="80"></el-table-column>
          <el-table-column prop="maxAchievement" label="最高分" width="80"></el-table-column>
          <el-table-column prop="minAchievement" label="最低分" width="180"></el-table-column>
          <el-table-column prop="averageAchievement" label="平均分" width="180"></el-table-column>
        </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  props: ['name','code','optionsM'],
  components: {
  },
  data() {
    return {
      studentAchievement:[],
      teacherAchievement:[],
    };
  },
  computed: {
  },
  watch: {
  },
  created() {
  },
  methods: {
    getStudentAchievement(){
      this.axios(`/SCS/studentCourse/selectCAchievement?studentCode=${this.code}`).then(
        response=>{
          this.studentAchievement=response.data
          console.log(response)
        },error=>{
          console.log(error)
        }
      )
    },
    getTeacherAchievement(){
      this.axios(`/SCS/teacher/selectTeacherCourseAchievement?code=${this.code}`).then(
        response=>{
          this.teacherAchievement=response.data
          console.log(response)
        },error=>{
          console.log(error)
        }
      )
    }
  },
  mounted(){
    this.getStudentAchievement()
    this.getTeacherAchievement()
  }
};
</script>
<style scoped lang="less">
</style>